//package com.zzh.partnersys.im.rocketmq.consumer;
//
//import com.zzh.partnersys.common.exception.BusinessException;
//import com.zzh.partnersys.mapper.TeamMapper;
//import com.zzh.partnersys.mapper.UserTeamMapper;
//import com.zzh.partnersys.oss.service.OSSService;
//import com.zzh.partnersys.rocketmq.contant.MQConstant;
//import com.zzh.partnersys.rocketmq.message.UpdateImageMes;
//import jakarta.annotation.Resource;
//import org.apache.rocketmq.spring.annotation.MessageModel;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.awt.image.BufferedImage;
//import java.io.InputStream;
//import java.util.List;
//
//import static com.zzh.partnersys.utils.ImageUtils.bufferedImageToInputStream;
//import static com.zzh.partnersys.utils.ImageUtils.getCombinationOfHeadToBufferedImages;
//
///**
// * @author zzh
// * @version 1.0
// * ����ͷ����µ�����??
// */
//@RocketMQMessageListener(
//        topic = MQConstant.UPDATE_TEAM_ICON_TOPIC,
//        consumerGroup = MQConstant.CONSUMER_GROUP_UPDATE_IMAGE_TEAM,
//        messageModel = MessageModel.BROADCASTING)
//@Component
//public class TeamImageUpdateMQConsumer implements RocketMQListener<UpdateImageMes> {
//
//    @Resource
//    private UserTeamMapper userTeamMapper;
//
//    @Resource
//    private TeamMapper teamMapper;
//
//    @Resource
//    private OSSService ossService;
//
//    @Override
//    @Transactional
//    public void onMessage(UpdateImageMes updateImageMes) {
//        Long teamId = updateImageMes.getTeamId();
//        //������ѯ����ĵ�ǰ���û���ͷ??//��Ϊ�Ǹ��������е���Ϣ��??�����Բ�ѯ�������û���
//        List<String> avatarUrls = userTeamMapper.selectListUserAvatarUrlByTeamId(teamId);
//        try {
//            BufferedImage bfImg = getCombinationOfHeadToBufferedImages(avatarUrls);
//            InputStream inputStream = bufferedImageToInputStream(bfImg, "png");
//            String url = ossService.avatarUpdate(inputStream, updateImageMes.getTeamName()+".png");
//            //���¶����ͷ??
//            teamMapper.updateTeamImageUrl(teamId, url);
//        } catch (Exception e) {
//            throw new BusinessException("�ϳ�ͷ��ʧ��", 40007);
//        }
//        System.out.println("����ͷ����³ɹ�");
//    }
//
//
//}
